﻿using System;

namespace AzukiMap.MapSource
{
    public enum MapSourceTypes
    {
        /*
        Point = 0,
        LineString,
        Polygon,
        MultiPoint,
        MultiLineString,
        MultiPolygon,
        GeometryCollection,
         */
        Vector = 0,
        Raster,
        Tile,
        LayerGroup,
    }

    /*
    public class MapSourceType
    {
        MapSourceTypes _type;

        string[] _MapTypesRev = 
        {
            "Point",
            "LineString",
            "Polygon",
            "MultiPoint",
            "MultiLineString",
            "MultiPolygon",
            "GeometryCollection",
            "Raster",
            "Tile",
            "LayerGroup",
        };

        public MapSourceTypes Type
        {
            set { _type = value; }
            get { return _type; }
        }

        public MapSourceType(string TypeString)
        {
            SetTypeByString(TypeString);
        }

        public MapSourceType(MapSourceTypes type)
        {
            _type = type;
        }

        public MapSourceTypes SetTypeByString(string TypeString)
        {
            bool matched = false;
            for (int i = 0; i < _MapTypesRev.Length; i++)
            {
                if (TypeString.Equals(_MapTypesRev[i], StringComparison.CurrentCultureIgnoreCase))
                {
                    matched = true;
                    _type = (MapSourceTypes)i;
                }
            }
            if (matched == false)
            {
                throw new FormatException("Layer type string is not correct.");
            }
            return _type;
        }

        public override string ToString()
        {
            string typeStr = _MapTypesRev[(int)_type];
            return typeStr;
        }

        public bool IsVector()
        {
            if (_type == MapSourceTypes.Point ||
                _type == MapSourceTypes.LineString ||
                _type == MapSourceTypes.Polygon ||
                _type == MapSourceTypes.MultiPoint ||
                _type == MapSourceTypes.MultiLineString ||
                _type == MapSourceTypes.MultiPolygon ||
                _type == MapSourceTypes.GeometryCollection
                )
            {
                return true;
            }
            else
            {
                return false;
            }
        }

    }
     */
}
